SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE [dbo].[usp_SearchFileLink]
      (
        @JOL_File_Type VARCHAR(50) ,
        @JOL_File_Title VARCHAR(100)
      )
AS 
      IF @JOL_File_Type = '全部' 
         SELECT JOL_File_No ,
                JOL_File_Title ,
                JOL_File_Type ,
                JOL_File_FileUrl ,
                JOL_File_AddTime
         FROM   dbo.JOL_FileLink
         WHERE  JOL_File_Title LIKE '%' + @JOL_File_Title + '%'
         ORDER BY JOL_File_AddTime DESC ,
                JOL_File_UpdateTime DESC
      ELSE 
         SELECT JOL_File_No ,
                JOL_File_Title ,
                JOL_File_Type ,
                JOL_File_FileUrl ,
                JOL_File_AddTime
         FROM   dbo.JOL_FileLink
         WHERE  JOL_File_Title LIKE '%' + @JOL_File_Title + '%'
                AND JOL_File_Type = @JOL_File_Type
         ORDER BY JOL_File_AddTime DESC ,
                JOL_File_UpdateTime DESC


GO
